﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/view.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="Workflow.Common.Tools" %>
<%@ Import Namespace="Workflow.Resource" %>

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <script>

        var products = "";

          
        $(function () {
            $('#tt').treegrid('options').queryParams.WorkStatus = $('#WorkStatus').combobox('getValue'); ;
            $('#tt').treegrid('options').queryParams.ReceiveDate = $('#ReceiveDate').datebox('getValue');
            $('#tt').treegrid('options').queryParams.CheckType = $('#CheckType').combobox('getValue'); ;
        
            //  $('#tt').treegrid('options').queryParams.ReceiveDate = '1';
            $('#tt').treegrid({
                title: '<%=Global.CaseMonitor%>',
                iconCls: 'icon-save',
                width: 1080,
                height: 600,
                nowrap: false,
                rownumbers: true,
                animate: true,
                collapsible: true,
                url: '/MSDEEM/GetRecievBox',
                idField: 'id',
                treeField: 'region',
                frozenColumns: [[
	                { title: ' ', field: 'region', width: 140
	                }
				]],
                columns: [[{ title: '旅費', colspan: 4 },
            { title: '旅費以外', colspan: 8 },
            { title: 'Total', colspan: 1}], [
					{ field: 'f7Page', title: '国内出張', width: 60 },
                    { field: 'f8Page', title: '近隣交通費', width: 80 },
					{ field: 'f9Page', title: '海外出張', width: 60 },
					{ field: 'total5Page', title: 'Total', width: 70 },
                    { field: 'f10Page', title: '会議費/交際費', width: 100 },
                    { field: 'f11Page', title: '寄付', width: 40 },
					{ field: 'f12Page', title: '開発研究関連', width: 80 },
                    { field: 'f13Page', title: '謝礼', width: 60 },
                    { field: 'f14Page', title: 'セミナー', width: 60 },
					{ field: 'f15Page', title: 'リベート', width: 60 },
                    { field: 'f16Page', title: 'その他（一般）', width: 80 },
					{ field: 'total6Page', title: 'Total', width: 40 },
                    { field: 'AllTotlePage', title: 'Total', width: 50, align: 'center' }
				]]

            });
            $('#ReceiveDate').datebox({
                formatter: function (date) { return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(); },
                parser: function (date) { return new Date(Date.parse(date.replace(/-/g, "/"))); }
            });

            $('#errorGrid').datagrid({
                width: 786,
                height: 365,
                fitColumns: true,
                nowrap: false,
                rownumbers: true,
                columns: [[
					{ field: 'ErrorMessage', title: '<%=Global.ErrorMessage %>', width: 120 },
                    { field: 'ReadFilePath', title: '<%=Global.ReadFilePath %>', width: 120 },
                    { field: 'DBFilePath', title: '<%=Global.DBFilePath %>', width: 120 }
				]]
            });

        });
        function seach() {
            $('#tt').treegrid('options').queryParams.WorkStatus = $('#WorkStatus').combobox('getValue'); ;
            $('#tt').treegrid('options').queryParams.ReceiveDate = $('#ReceiveDate').datebox('getValue');
            $('#tt').treegrid('options').queryParams.CheckType = $('#CheckType').combobox('getValue'); ;


            //  $('#tt').treegrid('options').queryParams.ReceiveDate = '2';

            $("#tt").treegrid();
        }
        function Received() {
            $('#form').form('submit', {
                url: '/GPEEM/EEMReceived',
                success: function (data) {
                    eval('data=' + data);

                    if (data.Success) {

                        $('#tt').treegrid('options').queryParams.WorkStatus = $('#WorkStatus').combobox('getValue'); ;
                        $('#tt').treegrid('options').queryParams.ReceiveDate = $('#ReceiveDate').datebox('getValue');
                        $('#tt').treegrid('options').queryParams.CheckType = $('#CheckType').combobox('getValue'); ;

                        $("#tt").treegrid();

                        products = "";
                        if (data.ErrorData.length > 0) {
                            products = data.ErrorData;
                        }

                        $.messager.alert('Info', data.Message, 'info', ShowErrorData);
                    } else {
                        $.messager.alert('Error', data.Message, 'error');
                    }
                    // window.location = '/User/Index';

                },
                onSubmit: function () {
                    //if (_user_form.valid())

                    return true;
                    // else
                    //    return false;
                }
            });
        }
        function ShowErrorData() {
            if (products != "") {
                $('#errorGrid').datagrid('loadData', products)
                $('#errorWin').window('open');
            }
        }
</script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<%
    using (Html.BeginForm("GetRecievBox", "MSDEEM", FormMethod.Post,
                      new { name = "form", id = "form" }))
    {%>
    <table id="tt" title="Case Monitor" class="easyui-treegrid" style="width: 900; height: 250px"
         rownumbers="true" showfooter="false" idfield="id" treefield="region"
        animate="true" toolbar="#td">

    </table>
    <div id="td">
  <div style="margin-bottom: 5px">
           <%=Global.ReceiveDate%>:: <input id="ReceiveDate"    class="easyui-datebox" style="width: 100px" value="<%=ToolsHelper.GetTimeZoneNow().ToString("yyyy/MM/dd")%>">

            <%--<a href="#" id="ReceiveDateNext" class="easyui-linkbutton" iconcls="icon-redo" plain="true">
                Next</a> --%>
                <%=Global.WorkStatus%>::<input id="WorkStatus"   class="easyui-combobox" style="width: 100px"
                    url="/MSDEEM/GetWorkStutes" valuefield="WorkStatusCode" textfield="WorkStatusName"
                    editable="false">
                    <%=Global.CheckType%>:
                <input id="CheckType" url="/GPEEM/GetFolderLevel?id=0" class="easyui-combobox" style="width: 100px"
                    valuefield="FolderCode" textfield="FolderName" multiple="false" editable="false">
                    <a href="#" class="easyui-linkbutton" iconcls="icon-search" onclick="seach();"><%=Global.Search%>:</a>
    <a href="#" class="easyui-linkbutton" iconcls="icon-search"
                    onclick="Received();">
                    <%=Global.Received %></a>
              
       </div>
    </div>
    <%
    }%>
     <div id="errorWin" class="easyui-window" closed="true" modal="true" minimizable="false"
        maximizable="false" draggable="false" resizable="false" collapsible="false" title="<%=Global.ReceivedFail %>"
        style="width: 800px; height: 400px;">
        <table id="errorGrid">
        </table>
    </div>
</asp:Content>
